﻿using System;
using System.Globalization;
using System.Web.UI;

namespace Practical.SharePoint.Base
{
    internal class HiddenDebugControl : Control
    {
        private readonly string _debugText;
        private readonly string _debugValue;

        public HiddenDebugControl(string debugText, string debugValue)
        {
            _debugText = debugText;
            _debugValue = debugValue;
        }

        protected override void Render(HtmlTextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            writer.Write(string.Format(CultureInfo.InvariantCulture,"<!--{0}: {1}-->",_debugText,_debugValue));
            base.Render(writer);
        }
    }
}
